goto out;
}
- if (!glnx_opendirat (refs_remotes_dfd, remote, TRUE, &dfd, error))
+ dfd = glnx_opendirat_with_errno (refs_remotes_dfd, remote, TRUE);
+ if (dfd < 0 && (errno != ENOENT || rev != NULL))
{
+ glnx_set_error_from_errno (error);
g_prefix_error (error, "Opening remotes/ dir %s: ", remote);
goto out;
}
if (rev == NULL)
{
- if (unlinkat (dfd, ref, 0) != 0)
+ if (dfd >= 0)
{
- if (errno != ENOENT)
- {
- glnx_set_error_from_errno (error);
- goto out;
- }
+ if (unlinkat (dfd, ref, 0) != 0)
+ {
+ if (errno != ENOENT)
+ {
+ glnx_set_error_from_errno (error);
+ goto out;
+ }
+ }
}
}
else